package com.ekalenchuk.postAd.domain.commercial;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

@Entity
@Table(name = "commercial")
public class Commercial implements Serializable {

	private static final long serialVersionUID = 6503351675631694029L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id")
	private Long id;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "commercial", cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.REMOVE })
	@OrderBy("id")
	private List<FieldValue> values;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "commercial", cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.REMOVE })
	private List<CommercialSite> sites;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public List<FieldValue> getValues() {
		return values;
	}

	public void setValues(List<FieldValue> values) {
		this.values = values;
	}

	public List<CommercialSite> getSites() {
		return sites;
	}

	public void setSites(List<CommercialSite> sites) {
		this.sites = sites;
	}

}
